import React, { Component } from 'react';

import "./App.scss"
//路由导入
import {
  BrowserRouter as Router,
  Switch,
  Route,
  NavLink
} from "react-router-dom";
import Dengluzhuce from "../../comend/Dengluzhuce/Dengluzhuce"
import Caozuo from '../../comend/Zhuye/Caozuo'
import Guanli from '../../comend/Zhuye/Guanli'
import Guanlishuju from '../../comend/Zhuye/Guanlishuju'

class App extends Component {
  constructor(props) {
    super(props)
    this.state = {
      logged: true
    }
  }
  loginGetHome = () => {
    this.setState({
      logged: false
    })
  }
  toLogin = () => {
    this.setState({
      logged: true
    })
  }
  ty=()=>{
    
  }
  render() {
    if (this.state.logged) {
      return (

        <div className="ss">
          <Dengluzhuce op={this.loginGetHome} />
        </div>
      );
    } else {
      return (
        <Router>
          <div className="zhuye">
            
            <ul className="qq">
              <li className='aaa'>
                <NavLink to="/guanli" exact className="po">管理首页</NavLink>
              </li>
              <li className='aaa'>
                <NavLink to="/guanlishuju" className="po" >管理数据</NavLink>
              </li>
              <li className='aaa'>
                <NavLink to="/caozuo" className="po">添加修改</NavLink>
              </li>
              <li className='aaa'>
                <span onClick={this.toLogin} className="po aaa">退出登录</span>
              </li>
            </ul>
            <div className="ooo">
            <Switch>
              <Route path="/guanli" component={Guanli} exact></Route>
              <Route path="/guanlishuju" component={Guanlishuju} ></Route>
              <Route path="/caozuo" component={Caozuo} ></Route>
            </Switch>
            </div>
          </div>
        </Router >
      )

    }

  }
}

export default App;

